package com.exploadingelephants.engine;

import android.view.GestureDetector.OnGestureListener;
import android.view.MotionEvent;

/**
 * Supported Gestures should be implemented here
 */
public class PlaygroundGestures implements OnGestureListener{
	PlaygroundActivity playgroundActivity;
	
	public PlaygroundGestures(PlaygroundActivity playgroundActivity) {
		this.playgroundActivity = playgroundActivity;
	}

	private static int downCounter = 0;
	
	/**
	 * We don't care about this gesture
	 */
	public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
		return true;
	}
	
	/**
	 * We don't care about this gesture
	 */
	public boolean onDown(MotionEvent e) {
		downCounter++;
		if(downCounter % 2 == 0){
			playgroundActivity.resume();
		}else{
			playgroundActivity.pause();
		}
		return false;
	}
	
	/**
	 * We don't care about this gesture
	 */
	public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { return true; }

	/**
	 * We don't care about this gesture
	 */
	public void onLongPress(MotionEvent e) {}
	
	/**
	 * We don't care about this gesture
	 */
	public void onShowPress(MotionEvent e) {}

	/**
	 * We don't care about this gesture
	 */
	public boolean onSingleTapUp(MotionEvent e) { return true; }
}
